<template>
  <div class="search">
    <f-form ref="form" :action="api.payway" :form-key="this.formItem.paywayId" >
      <f-form-item label="支付方式名称"  name="paywayName" dataType="${formField.dataType}"   :value="formItem.paywayName" />
      <f-form-item label="线下支付编码"  name="paywayCode" dataType="${formField.dataType}"   :value="formItem.paywayCode" />
      <f-form-item label="支付方式图标"  name="paywayIcon" dataType="${formField.dataType}"   :value="formItem.paywayIcon" />
      <f-form-item label="创建日期"  name="createDate" dataType="${formField.dataType}"   :value="formItem.createDate" />
      <f-form-item label="排序"  name="sort" dataType="number"   :value="formItem.sort" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'paywayForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          paywayId: '',
          paywayName: '',
          paywayCode: '',
          paywayIcon: '',
          createDate: '',
          sort: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.paywayId) {
          let params={
              paywayId:data.paywayId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
